package com.cn.icss.service.impl;

import com.cn.icss.service.IHelloService;
import com.cn.icss.vo.Country;
import com.jfinal.plugin.activerecord.Page;

import java.util.List;

/**
 * @中软华腾软件系统有限公司,未经授权不得擅自传播
 * @类描述:
 * @类名称:HelloServiceImpl
 * @作者: Administrator
 * @编辑时间: 2020/4/2 13:51
 * @版本: 1.0
 */
public class HelloServiceImpl implements IHelloService {

    private final Country country = new Country().dao();

    @Override
    public void sayHello() {
        try{
            System.out.println("Hello World!");
        }catch (Exception e){
            throw  e;
        }

    }

    @Override
    public void getAllCountries() {
        // 查询出所有的国家
        List<Country> all = country.findAll();
        Page<Country> pagenagte = country.paginate(1, 10, "select * ","from country");
        all.stream().forEach((x)->{
            System.out.println(x.getName()+","+x.getRegion());
        });
        System.err.println("-------------gogogo-------------");
        List<Country> all2 = pagenagte.getList();
        all2.stream().forEach(System.out::println);
//        for(Country c : all2){
//            System.out.println(c);
//        }

    }


}
